#!/bin/csh

#remove the port numbers
set newlines1 = "`cut -d "," -f 1,3- $1`"
set a  = `echo $newlines1 | sed '$s/.$//'`
set newlines2 = "`cut -d "," -f 1,3- $2`"

set i=0
if $#newlines1 != $#newlines2 then
	echo "false $#newlines1  : $#newlines2"
	exit 1
endif



#echo "2 : $newlines2"

set equal = true;

# need to still not compare the PORT command
#echo " i : $i newlines1 : $#newlines1" 
while ($i <= $#newlines1)
	set line =  `echo $newlines1[$i] | sed '$s/.$//'`
	#set line = `echo $newlines1[$i]`
	echo "comparing : $line.... VS : $newlines2[$i].... " 
	set isPORT = `echo $line | grep PORT`
	if ("$isPORT" != "") then
		set isPORT = `echo $newlines2[$i] | grep PORT`
		if ("$isPORT" == "") then
			set equal = false	
			echo 'BOTH ARE NOT  PORT\n'	
		endif
	else 
		set isPASV = `echo $line | grep "227 Passive"`
		if ("$isPASV" != "") then
			set isPASV = `echo $newlines2[$i] | grep "227 Passive"`
			if ("$isPASV" == "") then
				set equal = false	
				echo 'BOTH ARE NOT PASV\n'	
			endif
		
		else 

			if ( "$line" == "$newlines2[$i]" ) then
				#echo "OKKK  $line ....  : $newlines2[$i] ....\n" 
			else 
				set equal = false
				echo "NO ! $line $newlines2[$i]\n"
			endif
		endif
	endif	
	#echo " $i : $equal  : $line" 
	@ i++
end

if $equal == true then
	echo true
	exit 0 
else
	echo false
	exit 1
endif


